package com.cooliean;

import de.greenrobot.daogenerator.*;

/**
 * Created by Cooliean on 16/1/19.
 */
public class DaoGeneration {
    public static void main(String[] args) throws Exception {

        Schema schema = new Schema(12, "com.lemon.safecloud.greendao");
        schema.enableKeepSectionsByDefault();
        addNews(schema);
        addHiddenInfo(schema);
        addSelfCheckType(schema);
        addHiddenLevel(schema);
        addHiddenType(schema);
        addHiddenDangerInfo(schema);
        addPlayView(schema);
        addNewsColumn(schema);
//        addCompanyInfo(schema);
        new DaoGenerator().generateAll(schema, "/Users/Cooliean/Develop/Android/Sources/Intellij-IDEA/Lemon/safe_cloud/app/src/main/java-db-gen");
    }

    public static void addHiddenInfo(Schema schema) {
        Entity news = schema.addEntity("HiddenIndexInfo");
        news.addStringProperty("zeroStatus");
        news.addStringProperty("dangerCount");
        news.addStringProperty("companyName");
        news.addStringProperty("companyCode");
        news.addStringProperty("currentStartDate");
        news.addStringProperty("currentEndDate");
        news.addStringProperty("cycleType");
    }

    public static void addNews(Schema schema) {
        Entity news = schema.addEntity("LoginUser");
        news.addIdProperty();
        news.addStringProperty("userName");
        news.addStringProperty("userPassword");
        news.addDateProperty("logDate");
    }

    public static void addSelfCheckType(Schema schema) {
        Entity entity = schema.addEntity("SelfCheckType");
        entity.addIdProperty();
        entity.addIntProperty("typeId");
        entity.addStringProperty("typeName");
        entity.addStringProperty("remark");
    }

    public static void addHiddenLevel(Schema schema) {
        Entity entity = schema.addEntity("HiddenLevel");
        entity.addIdProperty();
        entity.addIntProperty("levelId");
        entity.addStringProperty("levelName");
        entity.addIntProperty("levelType");
    }


    /**
     * 隐患分类表
     *
     * @param schema
     */
    public static void addHiddenType(Schema schema) {
        Entity entity = schema.addEntity("HiddenType");
        entity.addIdProperty();
        entity.addIntProperty("typeId");
        entity.addStringProperty("typeName");
        entity.addIntProperty("parentId");
        entity.addStringProperty("classId");
        entity.addStringProperty("dangerType");
    }

    /**
     * 隐患信息
     * @param schema
     */
    public static void addHiddenDangerInfo(Schema schema) {
        Entity entity = schema.addEntity("HiddenDangerInfo");
        entity.addLongProperty("hiddenDangerId").primaryKey();
        entity.addStringProperty("checkPart");
        entity.addStringProperty("checkUserName");
        entity.addIntProperty("selfCheckId");
        entity.addStringProperty("selfCheckName");
        entity.addIntProperty("typeBigId");
        entity.addStringProperty("typeBigName");
        entity.addIntProperty("typeSmallId");
        entity.addStringProperty("typeSmallName");
        entity.addStringProperty("checkDate");
        entity.addStringProperty("reformDepartment");
        entity.addStringProperty("planFinishDate");
        entity.addIntProperty("LevelId");
        entity.addStringProperty("levelName");
        entity.addStringProperty("hiddenDangerContent");
        entity.addStringProperty("reformContent");
        entity.addStringProperty("reformPerson");
        entity.addStringProperty("reformFund");
        entity.addStringProperty("recordDate");
        entity.addStringProperty("recordUserId");
        entity.addStringProperty("recordUserName");
        entity.addBooleanProperty("isReformfinished");
        entity.addIntProperty("status");
        entity.addStringProperty("checkType");
        entity.addStringProperty("companyCode");
        entity.addIntProperty("attestCount");
    }

    public static void addPlayView(Schema schema) {
        Entity entity = schema.addEntity("PlayView");
        entity.implementsSerializable();
        entity.implementsInterface("EvidenceDataI");
        entity.addLongProperty("id").primaryKey();
        entity.addStringProperty("title");
        entity.addStringProperty("url");

    }
    public static void addNewsColumn(Schema schema) {
        Entity entity = schema.addEntity("NewsColumn");
        entity.implementsSerializable();
        entity.implementsInterface("SelectDataI");
        Property property = entity.addStringProperty("voId").primaryKey().getProperty();
        entity.addStringProperty("title");
        entity.addBooleanProperty("selected");

    }


//    /**
//     * 企业信息
//     * @param schema
//     */
//    public static void addCompanyInfo(Schema schema) {
//        Entity entity = schema.addEntity("CompanyInfo");
//        entity.implementsSerializable();
//        Property property = entity.addStringProperty("company_id").primaryKey().getProperty();
//        entity.addStringProperty("company_name");
//        entity.addStringProperty("company_code");
//        entity.addStringProperty("position_province_id");
//        entity.addStringProperty("place_name_province");
//        entity.addStringProperty("position_city_id");
//        entity.addStringProperty("place_name_city");
//        entity.addStringProperty("position_district_id");
//        entity.addStringProperty("place_name_district");
//        entity.addStringProperty("position_streets_id");
//        entity.addStringProperty("place_name_streets");
//        entity.addStringProperty("position_village_id");
//        entity.addStringProperty("place_name_village");
//        entity.addStringProperty("industry_type_id");
//        entity.addStringProperty("industry_type_name");
//
//        entity.addStringProperty("legal_person");//  法定代表人   字符串 20
//        entity.addStringProperty("legal_person_phone");//    法定代表人手机 字符串 20
//        entity.addStringProperty("legal_person_cid");//  法人证件号   字符串 20
//
//        entity.addStringProperty("fire_manager");//消防安全管理
//        entity.addStringProperty("fire_manager_cid");//消防安全管理
//        entity.addStringProperty("fire_manager_phone");//消防安全管理
//
//        entity.addStringProperty("fire_responsible");//  消防安全责任人 字符串 20
//        entity.addStringProperty("fire_responsible_cid");//  消防安全责任人证件号  字符串 20
//        entity.addStringProperty("fire_responsible_phone");//    消防安全责任人电话   字符串 20
//
//        entity.addStringProperty("type_id");//   单位性质    整数  1
//        entity.addStringProperty("type_title");//    单位性质标题
//        entity.addStringProperty("location");//  GPS定位信息 字符串 40
//        entity.addStringProperty("principal_name");//    负责人姓名   字符串 20
//        entity.addStringProperty("principal_phone");//   负责人手机   字符串 20
//        entity.addStringProperty("address");//   生产经营地址  字符串 500
//        entity.addStringProperty("license_photo");
//
////
////
////        Entity entityUploadItem = schema.addEntity("UploadFileItem");
////        entityUploadItem.implementsSerializable();
////        entityUploadItem.addIdProperty();
////        entityUploadItem.addStringProperty("fid");
////        entityUploadItem.addStringProperty("op");
////        entityUploadItem.addStringProperty("url");
////        entityUploadItem.addStringProperty("base64");
////        entityUploadItem.addStringProperty("ext");
////
////        private String fid    = "";
////        private String op     = "";
////        private String url    = "";
////        private String base64 = "";
////        private String ext    = "";
////        private int    type   = FileType.PHOTO.getValue();
////
//
//    }





}
